package com.example.zhangxin.myhuatuob2b.bean;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by ZhangXin on 2016/10/11.
 */

public class Home1Data {

    public static final String IMAGE = "image";
    public static final String TITLE = "title";
    public static final String TYPE = "type";
    public static final String DATA = "data";
    private String image;
    private String title;
    private String type;
    private String data;

    public Home1Data() {
    }

    public Home1Data(String image, String title, String type, String data) {
        this.image = image;
        this.title = title;
        this.type = type;
        this.data = data;
    }

    public static Home1Data newInstanceList(String json){
        Home1Data bean = null;
        try {
            JSONObject object = new JSONObject(json);
            if(object.length() > 0){
                String title = object.optString(TITLE);
                String type = object.optString(TYPE);
                String image = object.optString(IMAGE);
                String data = object.optString(DATA);
                bean = new Home1Data(image,title,type,data);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return bean;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }
}
